package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"strings"
)

func main() {
	dir := `F:\asdf`
	findDir(dir, 0)
}

func findDir(dir string, num int) {
	fileInfo, err := ioutil.ReadDir(dir)
	if err != nil {
		log.Fatal(err)
	}
	for _, f := range fileInfo {
		fmt.Print(strings.Repeat("\t", num))
		if f.IsDir() {
			fmt.Println("目录：", f.Name())
			findDir(dir+"/"+f.Name(), num+1)
		} else {
			fmt.Println("文件：", f.Name())
		}

	}
}
